# this needs to be set as $(libdir)/psd instead of $(moduledir) so that the RPM
# will install to the correct location.
modulesdir = $(libdir)/psd
modules_LTLIBRARIES = 

INCLUDES = -I@top_srcdir@/include -I@top_srcdir@/psd -I@top_srcdir@/libradix -I@top_srcdir@/compat -I@top_srcdir@/libconfig -I@top_srcdir@/libsoap-1.1.0 -I@XSP_DIR@/libxsp -I@XSP_DIR@/include -I@top_srcdir@/perfsonar
AM_CFLAGS = @CFLAGS@ -DMODULE_DIR=\"$(moduledir)\" -DCONFIG_FILE=\"$(CONFIG_FILE)\"

modules_LTLIBRARIES += xfer_sr.la
xfer_sr_la_SOURCES = psd_xfer_sr.c psd_xfer_sr.h
xfer_sr_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

modules_LTLIBRARIES += xfer_splice.la
xfer_splice_la_SOURCES = psd_xfer_splice.c psd_xfer_splice.h
xfer_splice_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

if HAVE_SLABS
modules_LTLIBRARIES += xfer_slabs.la
xfer_slabs_la_SOURCES = ring_buffer.c ring_buffer.h psd_xfer_slabs.c psd_xfer_slabs.h psd_backend_slabs.c psd_backend_slabs.h
xfer_slabs_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic
endif

if HAVE_LIBEVENT
modules_LTLIBRARIES += xfer_libevent.la
xfer_libevent_la_SOURCES = psd_xfer_libevent.c psd_xfer_libevent.h
xfer_libevent_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic @EVENT_LIBS@
endif

if HAVE_MX
# Change this part according to your mx installation directories
modules_LTLIBRARIES += xfer_mx.la
xfer_mx_la_SOURCES = psd_proto_mx.c psd_conn_mx.c psd_conn_mx.h
xfer_mx_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic
xfer_mx_la_LIBADD = /home/omer/gravel/install/mx/lib/libmyriexpress.a
INCLUDES += /home/omer/gravel/install/include
endif

if HAVE_NETFILTER
modules_LTLIBRARIES += transparent.la
transparent_la_SOURCES = psd_frontend_transparent.c
transparent_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic
endif

modules_LTLIBRARIES += stats.la
stats_la_SOURCES = psd_stats.c psd_stats.h
stats_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

modules_LTLIBRARIES += event_logger.la
event_logger_la_SOURCES = psd_event_logger.c
event_logger_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

modules_LTLIBRARIES += ls_registration.la
ls_registration_la_SOURCES = psd_ls_registration.c
ls_registration_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

if HAVE_LIBXML
AM_CFLAGS += @LIBXML_CFLAGS@
INCLUDES += -I../libsoap-1.1.0
ls_registration_la_LDFLAGS += @LIBXML_LIBS@
ls_registration_la_LIBADD = ../libsoap-1.1.0/nanohttp/libnanohttp.a
endif

# if HAVE_LIBXML
# modules_LTLIBRARIES += dragon_basic.la
# dragon_basic_la_SOURCES = psd_dragon_basic.c
# dragon_basic_la_CFLAGS = @LIBXML_CFLAGS@
# dragon_basic_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic  @LIBXML_LIBS@
# endif

#if ENABLE_OSCARS
modules_LTLIBRARIES += oscars_basic.la
oscars_basic_la_SOURCES = psd_oscars_basic.c oscars.c oscars.h
oscars_basic_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic
#endif

if HAVE_MYSQL
modules_LTLIBRARIES += stats_mysql.la
stats_mysql_la_SOURCES = psd_stats_mysql.c
stats_mysql_la_CFLAGS = @MYSQL_CFLAGS@
stats_mysql_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic @MYSQL_LIBS@
endif

if HAVE_SQLITE
modules_LTLIBRARIES += stats_sqlite.la
stats_sqlite_la_SOURCES = psd_stats_sqlite.c
stats_sqlite_la_CFLAGS = @SQLITE_CFLAGS@
stats_sqlite_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic @SQLITE_LIBS@
endif

modules_LTLIBRARIES += logger_stdout.la
logger_stdout_la_SOURCES = psd_logger_stdout.c
logger_stdout_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

modules_LTLIBRARIES += logger_file.la
logger_file_la_SOURCES = psd_logger_file.c
logger_file_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

modules_LTLIBRARIES += logger_syslog.la
logger_syslog_la_SOURCES = psd_logger_syslog.c
logger_syslog_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

modules_LTLIBRARIES += auth_anon.la
auth_anon_la_SOURCES = psd_auth_anon.c psd_auth_anon.h
auth_anon_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

modules_LTLIBRARIES += auth_pass.la
auth_pass_la_SOURCES = psd_auth_pass.c psd_auth_pass.h
auth_pass_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

modules_LTLIBRARIES += auth_pass_file.la
auth_pass_file_la_SOURCES = psd_auth_pass_file.c
auth_pass_file_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

if HAVE_MYSQL
modules_LTLIBRARIES += auth_pass_mysql.la
auth_pass_mysql_la_SOURCES = psd_auth_pass_mysql.c
auth_pass_mysql_la_CFLAGS = @MYSQL_CFLAGS@
auth_pass_mysql_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic @MYSQL_LIBS@
endif

if HAVE_SQLITE
modules_LTLIBRARIES += auth_pass_sqlite.la
auth_pass_sqlite_la_SOURCES = psd_auth_pass_sqlite.c
auth_pass_sqlite_la_CFLAGS = @SQLITE_CFLAGS@
auth_pass_sqlite_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic @SQLITE_LIBS@
endif

modules_LTLIBRARIES += auth_trust.la
auth_trust_la_SOURCES = psd_auth_trusted.c
auth_trust_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

if HAVE_WEB100
modules_LTLIBRARIES += tcp.la
tcp_la_SOURCES = psd_conn_tcp.c psd_conn_tcp.h psd_proto_tcp.c psd_web100.c psd_web100.h
tcp_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic @WEB100_LIBS@
tcp_la_CFLAGS = @WEB100_CFLAGS@ -DHAVE_WEB100 $(AM_CFLAGS)
else
modules_LTLIBRARIES += tcp.la
tcp_la_SOURCES = psd_conn_tcp.c psd_conn_tcp.h psd_proto_tcp.c
tcp_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic
tcp_la_CFLAGS = $(AM_CFLAGS)
endif

modules_LTLIBRARIES += udp.la
udp_la_SOURCES = psd_conn_udp.c psd_proto_udp.c psd_proto_udp.h
udp_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic
udp_la_CFLAGS = $(AM_CFLAGS)

modules_LTLIBRARIES += alarms.la
alarms_la_SOURCES = psd_alarms.c
alarms_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

modules_LTLIBRARIES += lsink.la
lsink_la_SOURCES = psd_lsink.c
lsink_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic

modules_LTLIBRARIES += lsrc.la
lsrc_la_SOURCES = psd_lsrc.c
lsrc_la_LDFLAGS = -no-undefined -module -avoid-version -export-dynamic
